<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>代理另一个代理</title>
</head>
<body>
  <script>
    const target = {
      foo: 'bar'
    };

    const firstProxy = new Proxy(target, {
      get() {
        console.log('first proxy');
        return Reflect.get(...arguments);
      }
    });

    const secondProxy = new Proxy(firstProxy, {
      get() {
        console.log('second proxy');
        return Reflect.get(...arguments);
      }
    });

    console.log(secondProxy.foo);
    // second proxy
    // first proxy
    // bar
  </script>
</body>
</html>